package book.book.controller;

import book.book.bean.Books;
import book.book.bean.Borrowinfo;
import book.book.bean.User;
import book.book.dao.*;
import book.book.service.*;

import java.util.Iterator;
import java.util.List;

public class A {
    public static void main(String[] args) {
        BooksService booksService = new BooksServiceImpl();
       // Books books = booksService.selectBooksByname("葫芦娃", "罗玲");
       // System.out.println(books);
        BorrowinfoService borrowinfoService = new BorrowinfoServiceImpl();
      // int i = borrowinfoService.updateBookCount("63e303ab8ff44d02b09a583ee41b2f46");
      // System.out.println(i);
        BorrowinfoDao borrowinfoDao = new BorrowinfoDaoImpl();
        //List<Borrowinfo> borrowinfos = borrowinfoDao.selectBorrwInfoByBookId("63e303ab8ff44d02b09a583ee41b2f46");
        //System.out.println(borrowinfos);
       // int i = borrowinfoDao.updateBookCountBack("63e303ab8ff44d02b09a583ee41b2f46", "花飞");

       // System.out.println(i);
        UserDao userDao = new UserDaoImpl();
        List<User> allUsers = userDao.getAllUsers();
        for (User user : allUsers) {
            System.out.println(user);
        }
        List<Borrowinfo> zhangsan = borrowinfoService.selectBinfoByUser("zhangsan");
        Iterator<Borrowinfo> iterator = zhangsan.iterator();
        while (iterator.hasNext()) {
            Borrowinfo borrowinfo = iterator.next();
            System.out.println(borrowinfo);
        }




    }
}
